Skip to content

Feature/githubcopilot with fixes#46095

Open
tendau wants to merge 12 commits intomainfrom
feature/githubcopilot-with-fixes
Open

Feature/githubcopilot with fixes#46095
tendau wants to merge 12 commits intomainfrom
feature/githubcopilot-with-fixes

Conversation

@tendau
Copy link
Copy Markdown
Member

@tendau tendau commented Apr 2, 2026

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@github-actions github-actions bot added the Hosted Agents sdk/agentserver/* label Apr 2, 2026
@tendau tendau force-pushed the feature/githubcopilot-with-fixes branch from 2a86ec9 to 621a8a7 Compare April 3, 2026 01:50
@tendau tendau marked this pull request as ready for review April 3, 2026 01:51
Copilot AI review requested due to automatic review settings April 3, 2026 01:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GitHub Copilot SDK adapter to use specific Copilot SDK import paths for tool discovery and permission/config types.

Changes:

  • Switch Tool import to from copilot.tools import Tool in tool discovery.
  • Switch PermissionRequestResult / ProviderConfig imports to from copilot.session import ... and remove the runtime fallback behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
sdk/agentserver/azure-ai-agentserver-githubcopilot/azure/ai/agentserver/githubcopilot/_tool_discovery.py Uses a single Copilot SDK import path for Tool.
sdk/agentserver/azure-ai-agentserver-githubcopilot/azure/ai/agentserver/githubcopilot/_copilot_adapter.py Uses a single Copilot SDK import path for permission/config types and removes fallback object construction.

Copy link
Copy Markdown
Member

@jodeklotzms jodeklotzms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this. I assume you've tested this more than I have!

@jodeklotzms
Copy link
Copy Markdown
Member

The change looks straightfoward to me, but here's my context agent's review:

 1. copilot.session.PermissionRequestResult, ProviderConfig — replaces 3-tier try/except fallback
 2. copilot.tools.Tool — replaces try/except with None fallback
 3. _perm_result simplified — removes None guard, always constructs the real object

You're right that my earlier concern about downstream Tool is not None checks was speculative. Looking at the actual diff, there's no issue — the _tool_discovery.py code that uses Tool would just import it directly now.

Updated recommendation: This is a clean, low-risk improvement. The only real question is whether copilot.session and copilot.tools are stable import paths in SDK 0.2.0+. If Chris tested it, approve it. I'd just ask him to fill in the PR description with a one-liner about what changed.

@tendau tendau enabled auto-merge (squash) April 3, 2026 02:59
@tendau tendau disabled auto-merge April 3, 2026 03:01
@tendau tendau force-pushed the feature/githubcopilot-with-fixes branch 2 times, most recently from 69bc19e to 9c6f6dd Compare April 3, 2026 20:31
jodeklotzms and others added 12 commits April 3, 2026 14:29
Major architecture change: FoundryCBAgent (inheritance) → AgentHost +
ResponseHandler (composition). Hypercorn replaces uvicorn.

Fixes:
- SSE streaming truncation (correct RAPI event ordering works natively)
- Duplicate text in streaming (only emit ASSISTANT_MESSAGE_DELTA)
- Eliminates heartbeat hack (built-in SSE keepalive)

Deleted:
- _copilot_response_converter.py (355 lines) — replaced by ResponseEventStream builders
- _copilot_request_converter.py (313 lines) — replaced by get_input_text()
- Unit tests for deleted converter

Preserved:
- Public API: GitHubCopilotAdapter.from_project(".").run()
- All env vars unchanged
- BYOK auth, model discovery, Tool ACL, skill/tool discovery
- Conversation history bootstrap (now uses own AsyncOpenAI client)

Dependencies:
- azure-ai-agentserver-core>=2.0.0a1 (was >=1.0.0b14,<1.0.0b18)
- azure-ai-agentserver-responses>=1.0.0a1 (new)
- Removed opentelemetry-exporter-otlp-proto-http (tracing via core[tracing])

Validated on ADC as trove-replat-v4 with correct streaming.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The ResponseHandler expects the create_handler to be an async generator
(with __anext__), not a coroutine. Fixed by using async for delegation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Azure DevOps feed is public — pip just needs --no-input to suppress
the interactive auth prompt in non-interactive builds (like ACR Tasks).
Removes wheel download/copy from deploy script and Dockerfile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Azure DevOps feed proxies github-copilot-sdk but requires auth for
upstream packages it hasn't cached. Fix: install base packages from
dev feed in a separate pip call, then install our package + deps from
PyPI only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix duplicate kwargs bug: remove explicit skill_directories/tools from
  create_session() calls — already present in sdk_config via _session_config
- Bump version to 1.0.0b2 to match CHANGELOG
- Remove .foundry-agent.json (contained real session/conversation IDs)
- Close AsyncDefaultCredential in _load_conversation_history to prevent
  async transport/socket leak
- Restore attachment handling: _extract_input_with_attachments() extracts
  input_file and input_image items from RAPI requests and appends to prompt
- Observe cancellation_signal in event loop to stop early on client disconnect
- Drop [tracing] extra from test Dockerfile to match pyproject.toml deps

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…issing

The ResponseHandler context only populates conversation_id when the
request includes an explicit "conversation" field. Most callers (invoke
scripts, Playground) only send session_id. Without this fallback,
conversation_id is always None and the adapter creates a fresh Copilot
SDK session on every request, breaking multi-turn.

Also fixes Windows --no-logs in integration test deploy script.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
conversation_id is only set when the request includes an explicit
"conversation" field. Most callers (invoke scripts, Playground) only
send session_id. The adapter now falls back to context.raw_body
["session_id"] and sets it on context.conversation_id so session
reuse and history bootstrap work transparently.

Also adds build tag canary for deployment verification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ound

The Playground sends conversation identity via raw_body['conversation']['id']
(from Chat Completions API translation), not session_id. The fallback now
checks both session_id and conversation.id in the raw body.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers input extraction with attachments, conversation_id fallback
(session_id and conversation.id from raw_body), session config
building, BYOK URL derivation, project endpoint resolution, and
skill directory discovery.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tendau tendau force-pushed the feature/githubcopilot-with-fixes branch from 9c6f6dd to fbe4de1 Compare April 3, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hosted Agents sdk/agentserver/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants